import React, { useEffect } from 'react';

const DeclareInfo = () => {

    const splitObject = () => {
        const o = {
            a: 'foo',
            b: 12,
            c: 'bar'
        }
        const {a, ...c} = o
        console.log(a, c)
    }

    const keepWholeObject = (wholeObject: {a: string, b?: number}):void => {
        const {a, b = 1001} = wholeObject
        console.log(a, b)
    }

    const splitValue = () => {
        const input = [34, 26, 88, 99];
        const [first, second] = input;
        testValue([first, second])
    }

    const testValue = ([first, second]: [number, number]) => {
        console.log(first, second)
    }

    useEffect(() => {
        splitObject()
        splitValue()
        keepWholeObject({a: '12', b: undefined})
    }, [])
    return <div>declare</div>
}

export default DeclareInfo